﻿using System;

namespace Sasa.QualityTools.CodeAnalysis.Core.Entities.CodeAnalysis
{
    /// <summary>
    /// This class represents FxCop rule metadata.
    /// </summary>
    public class Rule
    {
        /// <summary>
        /// The check id of FxCop rule.
        /// </summary>
        public string CheckId { get; set; }

        /// <summary>
        /// The category of FxCop rule.
        /// </summary>
        public string Category { get; set; }

        /// <summary>
        /// The name of FxCop rule.
        /// </summary>
        public string Name { get; set; }

        /// <summary>
        /// The description of FxCop rule.
        /// </summary>
        public string Description { get; set; }



        /// <summary>
        /// Compares to the specified object.
        /// </summary>
        /// <param name="obj">The object to compare to this instance.</param>
        /// <returns>True if the specified object is equivalent to this instance, otherwise false.</returns>
        public override bool Equals(object obj)
        {
            Rule rule = obj as Rule;
            if (rule == null)
            {
                return false;
            }

            return
                CheckId == rule.CheckId &&
                Category == rule.Category &&
                Name == rule.Name &&
                Description == rule.Description;
        }
    }
}
